package com.bjbn.controller;

import com.bjbn.service.FlightDataProcessor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/flight-data")
@Slf4j
public class FlightDataController {
    @Autowired
    private FlightDataProcessor flightDataProcessor;

    /**
     * 获取航班数据处理状态
     */
    @GetMapping("/status")
    public Map<String, Object> getStatus() {
        Map<String, Object> status = new HashMap<>();
        status.put("timestamp", System.currentTimeMillis());
        status.put("service", "Flight Data Processor");
        status.put("status", "running");
        return status;
    }

    /**
     * 获取延迟队列状态
     */
    @GetMapping("/delay-queue/status")
    public Map<String, Object> getDelayQueueStatus() {
        Map<String, Object> status = new HashMap<>();
        status.put("timestamp", System.currentTimeMillis());
        status.put("queue-size", flightDataProcessor.getDelayQueueSize());
        return status;
    }
} 